package com.jrh.dal.user.like;

import java.util.List;
import java.util.Map;

import com.jrh.dal.BaseDao;
import com.jrh.domain.common.Page;
import com.jrh.domain.entity.Brand;

/**
 * 用户喜欢商品DAO
 * 
 * @author jasen.hsu.cn@gmail.com 2012-8-7 下午8:03:03
 */
public class UserLikeBrandDao extends BaseDao<Brand> implements UserLikeReadDao<Brand> {

    public UserLikeBrandDao(){
        this.namespace = "jrh.single.brand";
    }

    @Override
    public Page<Brand> listUserLikeItems(Long userId, Integer start, Integer pageSize, Long style, Long category) {
        Map<String, Object> map = this.getPageMap(start, pageSize);
        map.put("style", style);
        map.put("category", category);
        map.put("userId", userId);
        @SuppressWarnings("unchecked")
        List<Brand> brandtList = (List<Brand>) sqlMapClientTemplate.queryForList(namespace + ".listUserlike", map);
        Integer count = (Integer) sqlMapClientTemplate.queryForObject(namespace + ".listUserlike_count", map);
        return new Page<Brand>(brandtList, start, pageSize, count);
    }

}
